struct Solution {}

fn main() {}

impl Solution {
    pub fn find_words(words: Vec<String>) -> Vec<String> {
        let mut ret_vec: Vec<String> = Vec::new();
        let first_row = vec!["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"];
        let first_second = vec!["a", "s", "d", "f", "g", "h", "j", "k", "l"];
        let first_third = vec!["z", "x", "c", "v", "b", "n", "m"];
        for word in words {
            if Solution::word_in_row(&first_row, &word) || Solution::word_in_row(&first_second, &word) || Solution::word_in_row(&first_third, &word) {
                ret_vec.push(word);
            }
        }
        ret_vec
    }

    fn word_in_row(row: &Vec<&str>, word: &String) -> bool {
        for charc in word.to_lowercase().chars() {
            if row.contains(&charc.to_string().trim() ) {
                continue;
            }
            else {
                return false;
            }
        }
        true
    }
}